package com.news.gpb.controller;

import com.news.gpb.entity.Card;
import com.news.gpb.service.CardService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin("http://localhost:8080")
@RestController
public class CardController {

    @Autowired
    CardService cardService;

    @RequestMapping("countCard")
    int cardCollect(@RequestBody Card card)
    {
        return cardService.cardCount(card.getUser_id());
    }

    @RequestMapping("getCard")
    List<Card> getCard(@RequestBody Card card)
    {
        return cardService.getCard(card);
    }

    @RequestMapping("reviewCard")
    List<Card> reviewCard(@RequestBody Card card)
    {
        return cardService.reviewCard(card);
    }

    @RequestMapping("makeCard")
    Integer makeCard(@RequestBody Card card) { return cardService.makeCard(card); }

    @RequestMapping("removeCard")
    Integer removeCard(@RequestBody Card card)
    {
        return cardService.removeCard(card);
    }

}
